package com.zcy.Reflect.util;

import java.lang.reflect.Method;

public class ReflectUtil {

	public static Object get(String path, String method, Object obj) {
		Class<?> demo = null;
		Object ret=null;
		try {
			demo = Class.forName(path);
			Object object = demo.newInstance();
		
			Method method2 = demo.getMethod(method, obj.getClass());
			ret=(String)method2.invoke(object, obj);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ret;
	}
	
	public static void main(String[] args) {
		//get("com.zcy.Reflect.Method", "say1", 12);
		Object s=get("com.zcy.Reflect.Method", "say2", "adsad");
		System.out.println(s.toString());
	}
}
